using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using MarketPlace.Data.DomainModels;
using MarketPlace.Data.Bases;

namespace MarketPlace.Data.ManagerObjects
{
    public partial interface IRegionManager : IManagerBase<MarketPlace.Data.DomainModels.Region, long>
    {
		// Get Methods
		Region GetByCode(System.String code);
    }

    partial class RegionManager : ManagerBase<MarketPlace.Data.DomainModels.Region, long>, IRegionManager
    {
		#region Constructors
		
		public RegionManager() : base()
        {
        }
        public RegionManager(INHibernateSession session) : base(session)
        {
        }
		
		#endregion
		
        #region Get Methods

		
		public Region GetByCode(System.String code)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(Region));
			
			
			criteria.Add(NHibernate.Criterion.Expression.Eq("Code", code));
			
			IList<Region> result = criteria.List<Region>();
			return (result.Count > 0) ? result[0] : null;
        }
		
		#endregion
    }
}